#ifndef FUZZYEDITOR_H
#define FUZZYEDITOR_H

#include <QWidget>

#include "setviewerpanel.h"
#include "systemcontrol.h"

class FuzzyEditor: public QWidget
{
    Q_OBJECT

public:

    FuzzyEditor(QWidget *parent, SystemControl *system);
    ~FuzzyEditor();

signals:
    void triangleSelected(bool b = true);
    void trapezoidSelected(bool b = true);
    void noSelection(bool b = true);

protected slots:

    /** Update the displayed values of the points when they are changed. */
    void updatePointValues();

    /** Ensure that the correct elements are enabled */
    void checkSelections();

    /** Updates the fuzzy sets so that their values repesent those displayed
     * in the text boxes.
     */
    void setPointValues();

    /** Set the currently viewed set to the one indicated by the name of the
     * slot.
     */
    void setToInputOne();
    void setToInputTwo();
    void setToOutput();

    /** Set the currently selected set to an entity of the type selected */
    void changeToTrapezoid(bool b = true);
    void changeToTriangle(bool b = true);

private:

    void clearSelections();

    /** A reference to the system controller for easy access to other objects
     */
    SystemControl* m_system;

    /** The viewing panel that this object uses to edit the points of the fuzzy
     * sets in the current scenario.
     */
    SetViewerPanel* m_viewer;

    /** Array of text blocks for point values */
    QLineEdit** m_point_values;

};

#endif // FUZZYEDITOR_H
